Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SetArray to keep old arrays for CEED_COPY_VALUES #1730

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jeremylt
Copy link
Member

Fixes #1728

Digging in, I think this is the best fix

Comment on lines -56 to -59
if (!*(void **)target_array_owned) CeedCallCuda(ceed, cudaMalloc(target_array_owned, size_unit * num_values));
if (source_array) CeedCallCuda(ceed, cudaMemcpy(*(void **)target_array_owned, source_array, size_unit * num_values, cudaMemcpyDeviceToDevice));
*(void **)target_array_borrowed = NULL;
*(void **)target_array = *(void **)target_array_owned;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here is where we were always dumping the old borrowed array

@jeremylt jeremylt force-pushed the jeremy/fix-vec-copy branch from f0c2a8a to cc3bdf8 Compare January 16, 2025 19:23
@@ -359,7 +359,7 @@ def test_126(ceed_resource, capsys):
a = np.arange(10, 10 + n, dtype=ceed.scalar_type())
x.set_array(a, cmode=libceed.USE_POINTER)

a2 = np.arange(10, n, dtype=ceed.scalar_type())
a2 = np.arange(0, n, dtype=ceed.scalar_type())
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's an embarrassing oops on my part from years ago

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need gen support for restriction-only identity operators
1 participant